package com.itheima.objstream;

import com.itheima.domain.User;

import java.io.*;

/*
序列化与反序列化的问题

 */
public class Demo02 {

    public static void main(String[] args) throws IOException, ClassNotFoundException {


        //out();
        //in();


    }

    private static void in() throws IOException, ClassNotFoundException {
        ObjectInputStream ois = new ObjectInputStream(new FileInputStream("day13\\user.txt"));
        Object o = ois.readObject();
        System.out.println(o);
    }

    private static void out() throws IOException {
        ObjectOutputStream oos = new ObjectOutputStream(new FileOutputStream("day13\\user.txt"));
        User kun = new User("kunkun", "520kunkun");
        oos.writeObject(kun);
        oos.close();
    }


}
